﻿using System;
using System.Windows;
using System.Windows.Controls;

namespace jSLCore.Client.Presentation.BaseControl.Selection
{
    public partial class ShowDetailsColumn : DataGridTemplateColumn
    {
        public ShowDetailsColumn()
        {
            InitializeComponent();
        }

        private void Cell_Clicked(object sender, RoutedEventArgs e)
        {
            var element = sender as FrameworkElement;
            InvokeCellClick(new RowSelectedEventArgs(element.DataContext));
            
        }

        public event EventHandler<RowSelectedEventArgs> CellClick;

        public void InvokeCellClick(RowSelectedEventArgs e)
        {
            EventHandler<RowSelectedEventArgs> handler = CellClick;
            if (handler != null) handler(this, e);
        }
    }
}
